import { AssetacquisitionManageAPI } from '../common/type';
import { Button, Tooltip } from 'antd';
import { tooltipLength } from '@/utils';
import pageStyles from '@/common/pageLayout.less';
import { Fragment } from 'react';
import { EditOutlined, EyeOutlined } from '@ant-design/icons';
import { stateOfRendering } from '../common';

// Table表格的配置
const getTableColumns = (curRes: Record<string, any>, operateFuns: AssetacquisitionManageAPI.IMaterialTableActionType) => {
  const { onView } = operateFuns;
  return [
    {
      title: '统计时间',
      dataIndex: 'statisticalTime',
      key: 'statisticalTime',
      width: 165,
      visible: true,
      unDrag: true,
      fixed: 'left',
      sorter: (a: any, b: any) => (a?.id > b?.id ? 1 : -1),
      // render: (text: string | null) => ColumnsRenderFun({ text, wordNum: 100 }),
    },
    {
      title: '所属单位',
      dataIndex: 'assetCompanyName',
      key: 'assetCompanyName',
      visible: true,
      width: 185,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.specInfo > b?.specInfo ? 1 : -1),
      // render: (text: string | null) => ColumnsRenderFun({ text }),
    },
    {
      title: '所属部门',
      dataIndex: 'assetDepartmentName',
      key: 'assetDepartmentName',
      fixed: 'left',
      width: 150,
      unDrag: true,
      visible: true,
      sorter: (a: any, b: any) => (a?.fullName > b?.fullName ? 1 : -1),
      render: (text: string | null, record: Record<string, any>) => {
        return (
          <Tooltip title={tooltipLength(text, 50)}>
            <span className={pageStyles['over-flow-hidden']}>{text || '--'}</span>
          </Tooltip>
        );
      },
    },
    {
      title: '资产类型',
      dataIndex: 'assetType',
      key: 'assetType',
      visible: true,
      width: 140,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.materialType > b?.materialType ? 1 : -1),
      render: (text: string | null, record: Record<string, any>) => {
        return (
          <Tooltip title={tooltipLength(text, 50)}>
            <span className={pageStyles['over-flow-hidden']}>{text || '--'}</span>
          </Tooltip>
        );
      },
    },
    {
      title: '折旧价值',
      dataIndex: 'statisticalPrice',
      key: 'statisticalPrice',
      visible: true,
      width: 185,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.specInfo > b?.specInfo ? 1 : -1),
      // render: (text: string | null) => ColumnsRenderFun({ text }),
    },
    {
      title: '修改人',
      dataIndex: 'modifyerID',
      key: 'modifyerID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '修改人岗位',
      dataIndex: 'modifyPositionID',
      key: 'modifyPositionID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '修改人部门',
      dataIndex: 'modifyDepartmentID',
      key: 'modifyDepartmentID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '修改人单位',
      dataIndex: 'modifyCompanyID',
      key: 'modifyCompanyID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '创建时间',
      dataIndex: 'createTime',
      key: 'createTime',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '创建人',
      dataIndex: 'createrID',
      key: 'createrID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '创建人岗位',
      dataIndex: 'createPositionID',
      key: 'createPositionID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '创建人部门',
      dataIndex: 'createDepartmentID',
      key: 'createDepartmentID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '创建人单位',
      dataIndex: 'createCompanyID',
      key: 'createCompanyID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '作废时间',
      dataIndex: 'cancelTime',
      key: 'createDepartmentID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '作废人',
      dataIndex: 'cancelerID',
      key: 'cancelerID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '作废人岗位',
      dataIndex: 'cancelPositionID',
      key: 'cancelPositionID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '作废人部门',
      dataIndex: 'cancelDepartmentID',
      key: 'cancelDepartmentID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '作废人单位',
      dataIndex: 'cancelCompanyID',
      key: 'cancelCompanyID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '作废原因',
      dataIndex: 'cancelReason',
      key: 'cancelReason',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '备注',
      dataIndex: 'remark',
      key: 'remark',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '经办时间',
      dataIndex: 'ownTime',
      key: 'ownTime',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '经办人',
      dataIndex: 'ownerID',
      key: 'ownerID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '经办人岗位',
      dataIndex: 'ownPositionID',
      key: 'ownPositionID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '经办人部门',
      dataIndex: 'ownDepartmentID',
      key: 'ownDepartmentID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
    {
      title: '经办人单位',
      dataIndex: 'ownCompanyID',
      key: 'ownCompanyID',
      visible: false,
      width: 150,
      unDrag: false,
      sorter: (a: any, b: any) => (a?.state > b?.state ? 1 : -1),
      render: (text: number | null) => stateOfRendering(text),
    },
  ];
};

export { getTableColumns };
